

        <?php require_once('inc_admin.php'); ?>

          <!--PAGE CONTENT -->
          <div id="content">

              <div class="inner" style="min-height:1200px;">
                  <div class="row">
                      <div class="col-lg-12">


              <?php 
require_once('inc_admin.php');
connect();
$password0=$_POST["password0"];
$password1=$_POST["password1"];
$password2=$_POST["password2"];
session_start();
var_dump($_SESSION);
echo $password0;
 if(strcmp($_SESSION['pwd'], $password0))
  redirect('changePassword.php','原密码错误，请重新修改');
elseif(strcmp($password1, $password2))
  redirect('changePassword.php','新密码输入不一致，请重新修改');
elseif(!strcmp($password0, $password1))
  redirect('changePassword.php','新密码与原密码相同，请重新修改');
else
{
  $sql = "update admins set password='$password2' where adminname='".$_SESSION['admin']."'";
     $result = mysql_query($sql) or die('sql=$sql,修改失败！<br/>'.mysql_error()); 
     $num = mysql_affected_rows();
  if($num!=0)
  redirect('login.php','修改成功，请重新登录');
  else {
   echo "修改失败！";
    echo "<a href= 'changePassword.php'>返回</a>";}
}
;
 ?>
                 
     

                      </div>
                  </div>
              </div>
               </div>
     
     
     <!-- FOOTER -->
      <div id="footer">
         
      </div>
      <!--END FOOTER -->
       <!-- GLOBAL SCRIPTS -->
      <script src="assets/plugins/jquery-2.0.3.min.js"></script>
       <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="assets/plugins/modernizr-2.6.2-respond-1.1.0.min.js"></script>
      <!-- END GLOBAL SCRIPTS -->












<?php 
require_once('inc_admin.php');
connect();
$password0=$_POST["password0"];
$password1=$_POST["password1"];
$password2=$_POST["password2"];
session_start();
 if(strcmp($_SESSION['pwd'], $password0))
  redirect('changePassword.php','原密码错误，请重新修改');
elseif(strcmp($password1, $password2))
  redirect('changePassword.php','新密码输入不一致，请重新修改');
elseif(!strcmp($password0, $password1))
  redirect('changePassword.php','新密码与原密码相同，请重新修改');
else
{
  $sql = "update admins set password='$password2' where adminname='".$_SESSION['admin']."'";
     $result = mysql_query($sql) or die('sql=$sql,修改失败！<br/>'.mysql_error()); 
     $num = mysql_affected_rows();
  if($num!=0)
  redirect('login.php','修改成功，请重新登录');
  else {
   echo "修改失败！";
    echo "<a href= 'changePassword.php'>返回</a>";}
}
// $result=mysql_query($sql) or die('添加失败!'.mysql_error());

//判断用户是否合法，如果合法，转向用户列表页面，否则转向登录页面
//  $num = mysql_affected_rows();
// if($num!=0)
//   redirect('typeAdd.php','添加成功');
// else
//   redirect('typeAdd.php','添加失败，请重新添加！');
 ?>